-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mixmix/custom-config #264
mixmix/custom-config #264
Conversation
fe90ac6
to
8236b29
Compare
resolve conflicts, get ready for review |
NOTE: this is passing all tests but will need a really close review + smoke test before merge. |
@rh0delta I want you to try and break this. I think I got everything but dial up the pedantry with this one. I turned of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good from reading the code, will take some time to test out everything locally tho, so will hold off on the approval
.argParser(aliasOrEndpoint => { | ||
/* see if it's a raw endpoint */ | ||
if (aliasOrEndpoint.match(/^wss?:\/\//)) return aliasOrEndpoint | ||
|
||
/* look up endpoint-alias */ | ||
const storedConfig = getConfigOrNull() | ||
const endpoint = storedConfig?.endpoints?.[aliasOrEndpoint] | ||
if (!endpoint) throw Error('unknown endpoint alias: ' + aliasOrEndpoint) | ||
|
||
return endpoint | ||
}) | ||
.default('wss://testnet.entropy.xyz/') | ||
// NOTE: default cannot be "test-net" as argParser only runs if the -e/--endpoint flag | ||
// or ENTROPY_ENDPOINT env set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the need to delete all of this? I'm all for it, just wondering the reason why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair question!
The addition of the of custom-config meant that we cannot do the argParser
stuff here, because to do that you need access to the storedConfig
, but you don't know that without the --config
loaded and parsed, which we cannot reach from in this function ...
SO I moved it all out into the loadEntropy
domain. The (edit: it is)default
should perhaps still be in there tho 🤔
* [NayNay] Testing Mix's Custom Config - the general purpose of the custom config works, however there is alot of work to be done regarding error handling - i have only started testing the custom config feature with a file that doesn't exist: ./custom-files/custom-config-<#>.json - this originally caused issues on the tui and did not allow for anything to start until the tui eventually errored out - similar errors were found with the cli as well - ive fixed the tui for the most part - but theres still lots to do to fix the cli in terms of proper error handling * Update src/common/utils-cli.ts * Update src/common/utils-cli.ts * Update src/common/utils-cli.ts * Update src/common/utils.ts --------- Co-authored-by: mix irving <[email protected]>
e2e tests passing too : yarn test:network:up
./tests/e2e.cli.sh
yarn test:network:down |
This part of a PR chain:
mixmix/config-types → mixmix/load-entropy → mixmix/custom-config
The purpose of this PR is to be able to set a custom config file path for CLI
NOTES
argParser
cannot beasync
.action
, probablyloadEntropy
--config
as the other leaf actionsentropy tui
orentropy ui